﻿using System;
using UnityEngine;

// Token: 0x020002B7 RID: 695
public class BoolStored
{
	// Token: 0x06000FFA RID: 4090 RVA: 0x000758A7 File Offset: 0x00073AA7
	public BoolStored(string key, bool defaultValue)
	{
		this.key = key;
		this.val = this.GetBoolValue(key, defaultValue);
	}

	// Token: 0x1700025E RID: 606
	// (get) Token: 0x06000FFB RID: 4091 RVA: 0x000758C4 File Offset: 0x00073AC4
	// (set) Token: 0x06000FFC RID: 4092 RVA: 0x000758CC File Offset: 0x00073ACC
	public bool value
	{
		get
		{
			return this.val;
		}
		set
		{
			this.val = value;
			this.SaveBoolValue(this.key, value);
		}
	}

	// Token: 0x06000FFD RID: 4093 RVA: 0x000758E4 File Offset: 0x00073AE4
	private bool GetBoolValue(string key, bool defaultValue)
	{
		if (PlayerPrefs.HasKey(key))
		{
			int @int = PlayerPrefs.GetInt(key);
			return this.IntToBool(@int);
		}
		return defaultValue;
	}

	// Token: 0x06000FFE RID: 4094 RVA: 0x0007590C File Offset: 0x00073B0C
	private bool IntToBool(int integer)
	{
		return integer != 0;
	}

	// Token: 0x06000FFF RID: 4095 RVA: 0x00075915 File Offset: 0x00073B15
	private void SaveBoolValue(string key, bool newValue)
	{
		PlayerPrefs.SetInt(key, this.BoolToInt(newValue));
	}

	// Token: 0x06001000 RID: 4096 RVA: 0x00075924 File Offset: 0x00073B24
	private int BoolToInt(bool boolean)
	{
		int result = 0;
		if (boolean)
		{
			result = 1;
		}
		return result;
	}

	// Token: 0x040014DF RID: 5343
	private string key;

	// Token: 0x040014E0 RID: 5344
	private bool val;
}
